#include "game.h"


std :: vector<int> ans_ljm, now_ljm;
bool vis_ljm[20], OKK;
int n_ljm;
void dfs_ljm(int k) {
	if(OKK) return; 
	if(k == n_ljm) {
		if(count(now_ljm) == n_ljm) {
			ans_ljm = now_ljm;
			OKK = 1;
			return;
		}
	}
	for(int i = 1; i <= n_ljm; i++) {
		if(vis_ljm[i]) continue;
		vis_ljm[i] = 1;
		now_ljm[k] = i;
		dfs_ljm(k + 1);
		vis_ljm[i] = 0;
	}
}

void Swap(int &x, int &y) {
	int z = x;
	x = y;
	y = z;
}

std :: vector<int> guess(int n, int limit) {
	/*if(n <= 9) {
		n_ljm = n;
		ans_ljm.clear(); now_ljm.clear();
		ans_ljm.resize(n);now_ljm.resize(n);
		OKK = 0;
		dfs_ljm(0);
		return ans_ljm;	
	}
	else {*/
		std :: vector<int>ans;
		ans.resize(n);
		for(int i = 0; i < n; i++) ans[i] = i + 1;
		while(1) {
			int lst = count(ans);
			bool flag = 0;
			for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++) {
				Swap(ans[i], ans[j]);
				int z = count(ans);
				if(z > lst) {
					lst = z;
					flag = 1;
				}
				else Swap(ans[i], ans[j]);
			}
			
			for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++)
			for(int k = j + 1; k < n; k++) {
				int A = ans[i], B = ans[j], C = ans[k];
				
				ans[i] = B; ans[j] = C; ans[k] = A;
				int z = count(ans);
				if(z > lst) {
					lst = z;
					flag = 1;
					continue;
				}
				else ans[i] = A; ans[j] = B; ans[k] = C;
				
				ans[i] = C; ans[j] = A; ans[k] = B;
				if(z > lst) {
					lst = z;
					flag = 1;
					continue;
				}
				else ans[i] = A; ans[j] = B; ans[k] = C;
				
				
			}
			if(!flag) break;
		}
		return ans;
	//}
}
/*
10 1000000
4 8 1 7 5 2 3
*/
